/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.base;

import com.losenote.enums.LnResultCodeEnum;

/**
 * 
 * @author danjingyu
 * @version $Id: FlException.java, v 0.1 2013-4-21 下午1:54:24 danjingyu Exp $
 */
public class LnException extends RuntimeException {

    /** serialVersionUID */
    private static final long serialVersionUID = -5353102099368631668L;

    /** 结果码 */
    private String            code             = "UNKNOWN";

    /** 异常信息 */
    private String            message          = "未知异常";

    /**
     * 构造方法
     *
     */
    public LnException() {
    }

    /**
     * 构造方法
     *
     */
    public LnException(String message) {
        this.setCode(LnResultCodeEnum.BIZ_ERROR.getCode());
        this.setMessage(message);
    }

    /**
     * 构造方法
     * 
     * @param resultCode 错误码
     */
    public LnException(LnResultCodeEnum resultCode) {
        this.setCode(resultCode.getCode());
        this.setMessage(resultCode.getDescription());
    }

    /**
     * 构造方法
     *
     * @param code
     */
    public LnException(String code, String message) {
        this.setCode(code);
        this.setMessage(message);
    }

    /**
     * 构造方法
     *
     * @param cause
     */
    public LnException(Throwable cause) {
        super("", cause);
    }

    /**
     * 构造方法
     *
     * @param cause
     */
    public LnException(LnResultCodeEnum resultCode, Throwable cause) {
        super("", cause);
        this.setCode(resultCode.getCode());
        this.setMessage(resultCode.getDescription());
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
